<?php

/**
 * Удаляет вопрос.
 *
 */
class Tests_Backend_Questions_Delete extends Backend_Component_Delete
{
    
    /**
     * Реализация обработки пользовательского запроса.
     *
     */
    protected function _delete() 
    {
        $query = '
            DELETE 
                   `t_q`, `t_a` 
              FROM 
                   `tests_questions` `t_q`
         LEFT JOIN 
                   `tests_answers` `t_a` 
                ON 
                   `t_a`.`question_id` = `t_q`.`id`
             WHERE 
                   `t_q`.`id` = ' . Application::getRequest()->get('id') . '
            ';
        database::query($query);
        return database::affectedRows();
    }
    
}
